package com.itboye.mengwu.data.repository;

import android.util.Log;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest;
import com.itboye.mengwu.data.interfaces.ILogGIns;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by itboye on 2017/4/18.
 */

public class LoginRepository extends BaseNetRepository implements
        ILogGIns<String> {
    String api = "100";
    public static final String GoodsQuery = "BY_User_loginBySession";// 自动登录

    public LoginRepository(ICompleteListener listener) {
        // TODO Auto-generated constructor stub
        super(listener);
    }

    @Override
    public void OnLogin(String uid, String login_session) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = api;
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("uid", uid);
        map.put("login_session", login_session);
        Log.d("uiduids", uid + "" + login_session);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(GoodsQuery, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void add(String model) {

    }

    @Override
    public void delete(String model) {

    }

    @Override
    public void update(String model) {

    }

    @Override
    public void getInfo(String model) {

    }

    @Override
    public List<String> queryYouHuiQuan(String model) {
        return null;
    }
}
